import React, { Component } from 'react';
import { ImageBackground, StatusBar, View, Image, DeviceEventEmitter, Text, TouchableOpacity, ScrollView, FlatList, Animated, AppState } from 'react-native';
import Colors from '../constants/Colors';

//吸顶view
export default class StickView extends Component {

    constructor(props) {
        super(props)
        this.state = {

        }
    }

    componentDidMount() {

    }

    componentWillUnmount() {

    }

    render() {
        const { scrollY, scrollStick, children } = this.props;
        const translateY = scrollY.interpolate({
            inputRange: [0, scrollStick, scrollStick, scrollStick + 1],
            outputRange: [0, 0, 0, 1],
        });
        return (
            <Animated.View style={[
                { backgroundColor: Colors.white },
                this.props.style,
                { transform: [{ translateY: translateY }] }
            ]}>
                {children}
            </Animated.View>
        );
    }
}
